﻿using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using TVersiPlay.Common;
using TVersiPlay.Common.Interfaces;
using TVersiPlay.MediaBrowse.ViewModels;
using TVersiPlay.MediaBrowse.Views;

namespace TVersiPlay.MediaBrowse
{
    public class MediaBrowseModule: IModule
    {
        private IUnityContainer container;
        private IRegionManager regionManager;
        private INavigationService navigationService;

        public MediaBrowseModule(IUnityContainer container, IRegionManager regionManager, INavigationService navigationService)
        {
            this.container = container;
            this.regionManager = regionManager;
            this.navigationService = navigationService;
        }

        public void Initialize()
        {
            this.RegisterTypesAndServices();
            this.RegisterViewsWithRegions();       
        }
               

        private void RegisterViewsWithRegions()
        {
            
        }

        protected void RegisterTypesAndServices()
        {
            this.container.RegisterType<IView, MediaBrowseView>(ViewNames.MediaBrowseView);
            this.container.RegisterType<IView, ThreeOrMoreMusicView>(ViewNames.ThreeOrMoreMusicView);
            this.container.RegisterType<IView, OneOrTwoMusicView>(ViewNames.OneOrTwoMusicView);

            this.container.RegisterType<IMediaBrowseViewModel, MediaBrowseViewModel>();

            

            //////ToDo: Dont need this here because it was registered with container in the bootstrapper
            ////this.container.RegisterType<INavigationService, NavigationService>(new ContainerControlledLifetimeManager());

            //this.container.RegisterType<IEmployeesView, EmployeesView>();

            //this.container.RegisterType<IEmployeesListView, EmployeesListView>();
            //this.container.RegisterType<IEmployeesListPresenter, EmployeesListPresenter>();

            //this.container.RegisterType<IEmployeesDetailsView, EmployeesDetailsView>();
            //this.container.RegisterType<IEmployeesDetailsPresenter, EmployeesDetailsPresenter>();
        }
    }
}
